<?php
/* Custom API function to extract all products configoptions from tblproducts */
if( preg_match('/^\d+$/', $_POST['pid']) ) {
$resource_id = mysql_query("SELECT * FROM tblproducts WHERE id='{$_POST['pid']}'");
$rows = mysql_num_rows($resource_id);
$xml = array();
$xml[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$xml[] = "<whmcsapi version=\"5.1.3\">\n";
$xml[] = "<action>getproductconfigurations</action>\n";
if( $rows !== 0) {
$xml[] = "<result>success</result>\n";
$xml[] = "<totalresults>".$amount."</totalresults>\n";
$xml[] = "<products>";
while( $row = mysql_fetch_assoc($resource_id) ) {
$xml[] = "<id>{$row['id']}</id>";
$xml[] = "<name>{$row['name']}</name>";
$xml[] = "<configoption1>{$row['configoption1']}</configoption1>";
//and all the stuff you want to get from tblproducts records
}
$xml[] = "</products>";
} else {
$xml[] = "<result>error</result>";
$xml[] = "<message>Couldn't find product by {$_POST['pid']}</message>";
}
$xml[] = "</whmcsapi>";
echo join("\n", $xml);
}
?>